package com.iengine.services.api.command.homecontrol;

import java.util.HashMap;
import java.util.Map;

import com.iengine.services.api.utils.Constant;
import com.iengine.services.api.utils.OperationName;

public class CommandHomeControl extends AbstractTxtHomeControlApiCommand {

	public static final String FIELD_OPERATION = "Operation";
	public static final String FIELD_PLACE = "Place";
	public static final String FIELD_FACILITY = "Facility";
	public static final String FIELD_MODE = "Mode";
	@Override
	protected Map formatArgs(Map map, Map nlpParams) {
		return process(map, nlpParams);
	}
	
	/**
	 * 数据清洗，返回标准格式
	 * @param nlpParams
	 * @return
	 */
	
	public Map<String,Object> process(Map<String, Object> map, Map<String, Object> nlpParams){
		String operation = getValue(nlpParams.get(FIELD_OPERATION),"");
		if(operation.equals(OperationName.homeControlOpen.getOperation())){
			nlpParams.put(FIELD_OPERATION, OperationName.homeControlOpen.getMappingValue());
		}else if(operation.equals(OperationName.homeControlClose.getOperation())){
			nlpParams.put(FIELD_OPERATION, OperationName.homeControlClose.getMappingValue());
		}
		map.put(Constant.FIELD_NLPPARAMS, nlpParams);
		return  map;
	}

}
